package ui;

import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class ClienteUI extends JFrame implements ActionListener {

	private static final long serialVersionUID = 1L;

	private JPanel jContentPane = null;

	private JLabel jlb_id = null;

	private JTextField jtxfld_id = null;

	private JLabel jlb_name = null;

	private JTextField jtxfld_name = null;

	private JButton jbtn_exit = null;
	
	/**
	 * This is the default constructor
	 */
	
	public ClienteUI() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(300, 200);
		this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		this.setContentPane(getJContentPane());
		this.setTitle("Cliente");
		this.setLocationRelativeTo(null);
		this.setResizable(false);
		this.setVisible(true);
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jlb_name = new JLabel();
			jlb_name.setBounds(new Rectangle(10, 45, 50, 21));
			jlb_name.setText("Nome.:");
			jlb_id = new JLabel();
			jlb_id.setBounds(new Rectangle(10, 10, 50, 21));
			jlb_id.setText("Cod.:");
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(jlb_id, null);
			jContentPane.add(getJtxfld_id(), null);
			jContentPane.add(jlb_name, null);
			jContentPane.add(getJtxfld_name(), null);
			jContentPane.add(getJbtn_exit(), null);
		}
		return jContentPane;
	}

	/**
	 * This method initializes jtxfld_id	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJtxfld_id() {
		if (jtxfld_id == null) {
			jtxfld_id = new JTextField();
			jtxfld_id.setEditable(false);
			jtxfld_id.setBounds(new Rectangle(75, 10, 50, 21));
		}
		return jtxfld_id;
	}

	/**
	 * This method initializes jtxfld_name	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJtxfld_name() {
		if (jtxfld_name == null) {
			jtxfld_name = new JTextField();
			jtxfld_name.setBounds(new Rectangle(75, 45, 150, 21));
		}
		return jtxfld_name;
	}

	/**
	 * This method initializes jbtn_exit	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJbtn_exit() {
		if (jbtn_exit == null) {
			jbtn_exit = new JButton();
			jbtn_exit.setIcon(new ImageIcon(getClass().getResource("/img/exit.gif")));
			jbtn_exit.setSize(new Dimension(28, 28));
			jbtn_exit.setLocation(new Point(260, 135));
			jbtn_exit.addActionListener(this);
		}
		return jbtn_exit;
	}

	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == jbtn_exit) {
			System.exit(0);
		}
		
	}

}
